package com.xq.servelt;

import javax.servlet.ServletConfig;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

/**
 * @author xq
 * @version 1.0
 * @date 2021/4/17 18:52
 * @description 用户Servlet
 */
public class UserServlet extends HttpServlet {
    /**
     * 初始化Servlet
     * @param config Servlet配置对象
     * @throws ServletException
     */
    @Override
    public void init(ServletConfig config) throws ServletException {
        String env = config.getInitParameter("env");
        String hello = config.getInitParameter("hello");
        System.out.println("env："+env + "，hello：" + hello);
    }

    /**
     *  get请求方法
     */
    @Override
    protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        System.out.println("hello -- UserServlet");
    }

    /**
     * post请求方法
     */
    @Override
    protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        super.doPost(req, resp);
    }
}
